package pe.com.cotelasa.scp.entidad;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
//import javax.validation.constraints.NotNull;
//import javax.validation.constraints.Size;

/**
 *
 * @author jeanpaul
 */
@Entity
@Table(name = "detalle_letra", catalog = "bdcotelasa", schema = "cotelasa")
@NamedQueries({
    @NamedQuery(name = "DetalleLetra.findAll", query = "SELECT d FROM DetalleLetra d"),
    @NamedQuery(name = "DetalleLetra.findById", query = "SELECT d FROM DetalleLetra d WHERE d.id = :id"),
    @NamedQuery(name = "DetalleLetra.findByEstadoRegistro", query = "SELECT d FROM DetalleLetra d WHERE d.estadoRegistro = :estadoRegistro"),
    @NamedQuery(name = "DetalleLetra.findByUsrCreacion", query = "SELECT d FROM DetalleLetra d WHERE d.usrCreacion = :usrCreacion"),
    @NamedQuery(name = "DetalleLetra.findByFecCreacion", query = "SELECT d FROM DetalleLetra d WHERE d.fecCreacion = :fecCreacion"),
    @NamedQuery(name = "DetalleLetra.findByUsrModificacion", query = "SELECT d FROM DetalleLetra d WHERE d.usrModificacion = :usrModificacion"),
    @NamedQuery(name = "DetalleLetra.findByFecModificacion", query = "SELECT d FROM DetalleLetra d WHERE d.fecModificacion = :fecModificacion")})
public class DetalleLetra implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
         
    @Basic(optional = false)
    @Column(name = "estado_registro")
    private char estadoRegistro;
    
    @Basic(optional = false)
    @Column(name = "usr_creacion")
    private String usrCreacion;
    
    @Basic(optional = false)
    @Column(name = "fec_creacion")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecCreacion;

    @Column(name = "usr_modificacion")
    private String usrModificacion;
    
    @Column(name = "fec_modificacion")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fecModificacion;
    
    @JoinColumn(name = "id_letra", referencedColumnName = "id")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Letra idLetra;
    
    @JoinColumn(name = "id_compra_facturacion", referencedColumnName = "id")
    @ManyToOne(fetch = FetchType.LAZY)
    private CompraFacturacion idCompraFacturacion;
    
    @JoinColumn(name = "id_venta_facturacion", referencedColumnName = "coddocventa")
    @ManyToOne(fetch = FetchType.LAZY)
    private VentaFacturacion idVentaFacturacion;
    
    public DetalleLetra() {
    }

    public DetalleLetra(Integer id) {
        this.id = id;
    }

    public DetalleLetra(Integer id, long cantidad, long precioUnitario, BigInteger precioTotal, String unidadMedida, char estadoRegistro, String usrCreacion, Date fecCreacion) {
        this.id = id;
        this.estadoRegistro = estadoRegistro;
        this.usrCreacion = usrCreacion;
        this.fecCreacion = fecCreacion;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }
 
    public char getEstadoRegistro() {
        return estadoRegistro;
    }

    public void setEstadoRegistro(char estadoRegistro) {
        this.estadoRegistro = estadoRegistro;
    }

    public String getUsrCreacion() {
        return usrCreacion;
    }

    public void setUsrCreacion(String usrCreacion) {
        this.usrCreacion = usrCreacion;
    }

    public Date getFecCreacion() {
        return fecCreacion;
    }

    public void setFecCreacion(Date fecCreacion) {
        this.fecCreacion = fecCreacion;
    }

    public String getUsrModificacion() {
        return usrModificacion;
    }

    public void setUsrModificacion(String usrModificacion) {
        this.usrModificacion = usrModificacion;
    }

    public Date getFecModificacion() {
        return fecModificacion;
    }

    public void setFecModificacion(Date fecModificacion) {
        this.fecModificacion = fecModificacion;
    }

    public Letra getIdLetra() {
        return idLetra;
    }

    public void setIdLetra(Letra idLetra) {
        this.idLetra = idLetra;
    }
    
    public CompraFacturacion getIdCompraFacturacion() {
		return idCompraFacturacion;
	}
    
    public void setIdCompraFacturacion(CompraFacturacion idCompraFacturacion) {
		this.idCompraFacturacion = idCompraFacturacion;
	}
    
    public VentaFacturacion getIdVentaFacturacion() {
		return idVentaFacturacion;
	}
    
    public void setIdVentaFacturacion(VentaFacturacion idVentaFacturacion) {
		this.idVentaFacturacion = idVentaFacturacion;
	}

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof DetalleLetra)) {
            return false;
        }
        DetalleLetra other = (DetalleLetra) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "domain.DetalleLetra[ id=" + id + " ]";
    }
    
}
